package Thread.Thread_State;

/**
 * 线程的新建，运行和终止状态
 */
public class State {
    public static void main(String[] args) {
        //产生一个新的线程对象，该对象默认的状态就是新建状态（NEW）
        Thread t1=new Thread(()->{
            for (int i = 0; i <50000; i++) {

            }
        },"子线程");
        System.out.println(t1.getName()+":"+t1.getState());
        t1.start();
        while (t1.isAlive()){
            System.out.println(t1.getName()+":"+t1.getState());
        }
        System.out.println(t1.getName()+":"+t1.getState());
    }
}
